package javaapplication2;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class OutputStreamWriterDemo {
       public static void main(String[] args) {
      try {
         OutputStream os = new FileOutputStream("test.txt");
         OutputStreamWriter writer = new OutputStreamWriter(os);
         FileInputStream in = new FileInputStream("test.txt");
         writer.write(70);
         writer.flush();
         System.out.println("" + (char) in.read());
         System.out.println("Closing Stream...");
         writer.close();
         System.out.println("Stream closed.");
      } catch (Exception ex) {
         ex.printStackTrace();
      }
   }
}
